﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BeanboxSoftware.BeanProxy;

namespace BeanboxSoftware.BeanProxyTest
{
  [TestClass]
  public class MethodConfigTest
  {
    [TestMethod]
    public void InvokeInternalTest()
    {
      var proxy = ProxyManager.CreateProxy<MethodConfigTest>();
      var config = ProxyManager.GetAction<Exception>(proxy.Throws);
      config.IsReal = true;

      TestUtils.AssertExceptionThrown<NotImplementedException>(() =>
      {
        config.Invoke(new NotImplementedException());
      });
    }

    public virtual void Throws(Exception ex)
    {
      throw ex;
    }

    [TestMethod]
    public void MethodConfigCtorTest()
    {
      var mc = new MethodConfig();
      mc.Initialize(null, null);
      Assert.IsTrue(mc.IsReal, "default real for null action");
    }
  }
}
